#include <vector>

using namespace std;

class Solution
{
public:
    int MoreThanHalfNum_Solution(vector<int> numbers)
    {
        int num = numbers[0];
        int len = 1;
        for (int i = 1; i < numbers.size(); ++i)
        {
            if (numbers[i] != num)
            {
                len--;
            }
            else
            {
                len++;
            }
            if (len < 0)
            {
                num = numbers[i];
                len = 0;
            }
        }
        return num;
    }
};